package com.qfedu.smart_community.utils;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @version v1.0
 * @Date 2023/10/18 14:29
 * @Author DARKER
 * @Email 1402216045@qq.com
 */

/**
 * 日期转换器
 */
public class MyDateConverter implements Converter<String, Date> {
    @Override
    public Date convert(String s) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
             date = sdf.parse(s);

        } catch (ParseException e) {
            e.printStackTrace();
        }

        return date;
    }
}
